SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

CREATE PROCEDURE [dbo].[usp_UpdateTeacherInfo]
      (
        @fdTeacLoginID VARCHAR(50) ,
        @fdTeacPwd VARCHAR(50) ,
        @fdTeacName VARCHAR(50) ,
        @fdTeacCollID VARCHAR(50) ,
        @fdTeacLevel INT
      )
AS 
      DECLARE @Pwd VARCHAR(50)
      SET @Pwd = (
                   SELECT   fdTeacPwd
                   FROM     dbo.FS_Teacher
                   WHERE    fdTeacLoginID = @fdTeacLoginID
                 )
      UPDATE    dbo.FS_Teacher
      SET       fdTeacPwd = CASE @fdTeacPwd
                              WHEN '' THEN @Pwd
                              ELSE @fdTeacPwd
                            END ,
                fdTeacName = @fdTeacName ,
                fdTeacCollID = @fdTeacCollID ,
                fdTeacLevel = @fdTeacLevel
      WHERE     fdTeacLoginID = @fdTeacLoginID

GO
